package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.EditPwdBean;
import com.lwj.liwanjia.impl.EditPwdView;
import com.lwj.liwanjia.model.EditPwdModel;

import java.util.Map;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/10/27.
 */

public class EditPwdPresnter {
    private EditPwdModel editPwdModel;
    private EditPwdView editPwdView;

    public EditPwdPresnter(EditPwdView editPwdView) {
        this.editPwdView = editPwdView;
        editPwdModel = new EditPwdModel();
    }

    public void editPwd(Map<String, Object> map) {
        if (editPwdView != null) {
            editPwdModel.editPwd(map, new Subscriber<EditPwdBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    editPwdView.showError((Exception) e);
                }

                @Override
                public void onNext(EditPwdBean editPwdBean) {
                    editPwdView.editPwd(editPwdBean);
                }
            });
        }
    }
}
